<template>
    <div v-loading="loading">
        <div @click="$router.go(-1)" style="display: flex;align-items: center;cursor: pointer;margin-bottom: 20px;">
            <i class="el-icon-arrow-left" style="font-size: 20px;color: #409eff;"></i>
             <div style="color: #409eff;">返回</div>
        </div>
        <template>
            <el-descriptions :column="3" border class="margin-top" title="用户资金记录详情">
                <el-descriptions-item>
                    <template slot="label">用户</template>
                    <!-- <div v-if="datas.user_info_more" style="display: flex;align-items: center;">
                        <el-avatar size="medium" :src="datas.user_info_more.avatar" style="margin-right: 10px;"></el-avatar>
                        {{ datas.user_info_more.name }}
                    </div>-->

                    <UserInfo :user_id="datas.user_id" :userInfos="datas.user" v-if="datas.user_id"></UserInfo>
                </el-descriptions-item>
                <el-descriptions-item>
                    <template slot="label">ID</template>
                    {{ datas.id }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.object_user">
                    <template slot="label">来自收益的对象</template>
                    <UserInfo :user_id="datas.object_user.id" :userInfos="datas.object_user" v-if="datas.object_user"></UserInfo>
                </el-descriptions-item>
    

                <el-descriptions-item>
                    <template slot="label">操作类型</template>
                    <div v-if="datas.action == 'wthdraw'">提现</div>
                    <div v-else-if="datas.action == 'recharge'">充值</div>
                    <div v-else-if="datas.action == 'refund'">退款</div>
                    <div v-else-if="datas.action == 'expend'">消费</div>
                    <div v-else-if="datas.action == 'profit'">收益</div>
                </el-descriptions-item>
                <el-descriptions-item>
                    <template slot="label">操作金币</template>
                    {{ datas.amount }}
                </el-descriptions-item>

                <el-descriptions-item>
                    <template slot="label">事由</template>
                    <div v-if="datas.type == 'live'">直播付费</div>
                    <div v-else-if="datas.type == 'withdraw'">提现</div>
                    <div v-else-if="datas.type == 'invite_rebate'">邀请新人</div>
                    <div v-else-if="datas.type == 'short'">短视频</div>
                    <div v-else-if="datas.type == 'long'">长视频</div>
                    <div v-else-if="datas.type == 'same_city'">同城</div>
                    <div v-else-if="datas.type == 'one_by_one'">1V1密聊</div>
                    <div v-else-if="datas.type == 'customized'">私人订制</div>
                    <div v-else-if="datas.type == 'tipping'">打赏</div>
                    <div v-else-if="datas.type == 'gift'">直播礼物</div>
                    <div v-else-if="datas.type == 'rebate'">下级返利</div>
                </el-descriptions-item>

                

                <el-descriptions-item>
                    <template slot="label">资金类型</template>
                    <div v-if="datas.coin_type == 'balance'">金币余额</div>
                    <div v-else-if="datas.coin_type == 'cny'">人民币</div>
                </el-descriptions-item>

                <el-descriptions-item>
                    <template slot="label">操作前金币</template>
                    {{ datas.before }}
                </el-descriptions-item>

                <el-descriptions-item>
                    <template slot="label">操作后金币</template>
                    {{ datas.after }}
                </el-descriptions-item>

           

             
                <el-descriptions-item>
                    <template slot="label">关联订单号</template>
                    {{ datas.trade_no }}
                </el-descriptions-item>

                <el-descriptions-item>
                    <template slot="label">资金描述</template>
                    {{ datas.desc }}
                </el-descriptions-item>

                <el-descriptions-item  v-if="datas.type == 'tipping'">
                    <template slot="label">作品ID</template>
                    {{ datas.relation.creation_id }}
                </el-descriptions-item>

                <el-descriptions-item  v-if="datas.type == 'tipping'">
                    <template slot="label">作品类型</template>
                    <div v-if="datas.relation.creation_type == 'infomation'">帖子</div>
                    <div v-else-if="datas.relation.creation_type == 'long'">长视频</div>
                    <div v-else-if="datas.relation.creation_type == 'short'">短视频</div>
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'tipping'">
                    <template slot="label">作品内容</template>
                    {{ datas.relation.content }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'tipping'">
                    <template slot="label">作品内容</template>
                    {{ datas.relation.content }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'gift'">
                    <template slot="label">直播ID</template>
                    {{ datas.relation.live_id }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'gift'">
                    <template slot="label">房间号</template>
                    {{ datas.relation.room_id }}
                </el-descriptions-item>

                <el-descriptions-item  v-if="datas.type == 'long' || datas.type == 'short'">
                    <template slot="label">作品ID</template>
                    {{ datas.relation.creation_id }}
                </el-descriptions-item>

                <el-descriptions-item  v-if="datas.type == 'long'  || datas.type == 'short'">
                    <template slot="label">作品类型</template>
                    <div v-if="datas.relation.creation_type == 'infomation'">帖子</div>
                    <div v-else-if="datas.relation.creation_type == 'long'">长视频</div>
                    <div v-else-if="datas.relation.creation_type == 'short'">短视频</div>
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'long'  || datas.type == 'short'">
                    <template slot="label">作品名称</template>
                    {{ datas.relation.creation_name }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'recharge'">
                    <template slot="label">充值人民币</template>
                    {{ datas.relation.money }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'withdraw'">
                    <template slot="label">提现手续费人民币</template>
                    {{ datas.relation.fee }}
                </el-descriptions-item>

                <el-descriptions-item  v-if="datas.type == 'withdraw'">
                    <template slot="label">到账金额人民币</template>
                    {{ datas.relation.money }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'withdraw'">
                    <template slot="label">提现状态</template>
                    <el-tag v-if="datas.relation.status == 0" type="warning">待审核</el-tag>
                        <el-tag v-else-if="datas.relation.status == 1" type="success">已通过</el-tag>
                        <el-tag v-else-if="datas.relation.status == 2" type="danger">已拒绝</el-tag>
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'withdraw'">
                    <template slot="label">{{ datas.relation.status == 1? '提现通过时间' :  datas.relation.status == 2 ? '提现拒绝时间' : '提现修改时间'}}</template>
                    {{ datas.relation.updated_at }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'withdraw'">
                    <template slot="label">添加提现时间</template>
                    {{ datas.relation.created_at }}
                </el-descriptions-item>

                <el-descriptions-item>
                    <template slot="label">用户资金记录详情添加时间</template>
                    {{ datas.created_at }}
                </el-descriptions-item>

                <el-descriptions-item v-if="datas.type == 'withdraw' && datas.relation.status == 2">
                    <template slot="label">拒绝理由</template>
                    {{ datas.relation.refuse_reason }}
                </el-descriptions-item>
            </el-descriptions>

        </template>

        <div></div>
    </div>
</template>
      
<script>
export default {
    data() {
        return {
            visible: false,
            loading: false,
            tabdata: [],
            datas: {},
        }
    },
    mounted() {
        //this.getworksList()
        if (this.$route.query.id) {
            console.log('this.$route.query.id', this.$route.query.id)
            this.getInfo(this.$route.query.id)
        }
    },
    methods: {

        getInfo(id) {
            let that = this
            this.$request.get('/money-log/get/' + id).then((res) => {
                that.tabdata = []
                that.datas = res
                console.log('res', res)
                that.tabdata.push(res)
            })
        },
    },
}
</script>
      
<style lang="scss" >
.el-button--text {
    margin-right: 20px !important;
}

.el-popover {
    width: 250px;
}
</style>